<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>知果汇</title>
    <link href="__STATIC__/admin/css/bootstrap.min.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="__STATIC__/admin/js/html5shiv.min.js"></script>
    <script src="__STATIC__/admin/js/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
        body {
            background-color: #ffffff;
        }

        .main-box {
            text-align: center;
            font-size: 16px;
        }

        .main-box p {
            text-align: center;
            margin-top: 15px;
        }

        .btn {
            width: 100px;
        }

        .btn-b, .btn-b:hover, .btn-b:focus {
            background-color: #3171b4;
            border-color: #3171b4;
            color: #ffffff;
        }

        .btn-c, .btn-c:hover, .btn-c:focus {
            background-color: #666666;
            border-color: #666666;
            color: #ffffff;
        }
    </style>
</head>
<body>
<div class="main-box">
    <p>上传快递单号</p>
    <p>买家快递单号：<span><input type="text" id="express_username" name=""></span></p>
    <p>卖家快递单号：<span><input type="text" id="express_seller" name=""></span></p>
    <div class="buttons" style="margin-top: 15px;">
        <a href="javascript: void(0);" class="btn btn-b" onclick="confirm(this)">确认</a>
        <a href="javascript: void(0);" class="btn btn-c" onclick="cancel(this)">取消</a>
    </div>
</div>

<script src="__STATIC__/admin/js/jquery.min.js"></script>
<script src="__STATIC__/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/layer/layer.js"></script>
<script type="text/javascript">
    var url = window.location.href;
    id = url.split("#")[1];
    page_id = url.split("#")[2]

    function confirm(obj) {
        var express_username = $("#express_username").val();
        var express_seller = $("#express_seller").val();
        //传递参数
        $.ajax({
            type: 'GET',
            url: "{:url('api/orders/orders_express')}",
            dataType: 'jsonp',
            jsonp: 'callback',
            data: {'id': id, 'express_username': express_username, 'express_seller': express_seller},
            success: function (msg) {
                if (msg.code == 200) {
                    layer.msg('上传订单成功!', {icon: 1, time: 2000});
                    parent.postfile(page_id);
                } else {
                    layer.msg('上传订单失败!', {icon: 5, time: 2000});
                }
            }
        })

        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index); //关闭弹出层

    }

    function cancel(obj) {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index); //关闭弹出层

    }
</script>
</body>
</html>